using Game.Core;
using Game.Main.Model;
using Game.Manager;
using UnityEngine;

namespace Game.Component.Operation
{
	public class MainComponent : OperationComponent
	{
		private Transform option1;

		private Transform option2;

		private Transform option3;

		private Transform option4;

		private Transform option5;

		private Transform option6;

		private Transform option7;

		private Transform option8;

		private void Awake()
		{
			option1 = base.transform.Find("1");
			option2 = base.transform.Find("2");
			option3 = base.transform.Find("3");
			option4 = base.transform.Find("4");
			option5 = base.transform.Find("5");
			option6 = base.transform.Find("6");
			option7 = base.transform.Find("7");
			option8 = base.transform.Find("8");
		}

		public override void TouchDown(TouchEventData touchEventData)
		{
			if (displayer == null)
			{
				return;
			}
			base.TouchDown(touchEventData);
			RaycastHit2D raycastHit2D = Physics2D.Raycast(touchEventData.curPos, Vector2.zero, 15f, 1);
			if (!(raycastHit2D.collider != null))
			{
				return;
			}
			if (raycastHit2D.collider.transform == option1)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game1);
			}
			else if (raycastHit2D.collider.transform == option2)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game2);
			}
			else if (raycastHit2D.collider.transform == option3)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game3);
			}
			else if (raycastHit2D.collider.transform == option4)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game4);
			}
			else if (raycastHit2D.collider.transform == option5)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game5);
			}
			else if (raycastHit2D.collider.transform == option6)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game6);
			}
			else if (raycastHit2D.collider.transform == option7)
			{
				displayer.ChangeType(OperationDisplayerItem.Type.Game7);
			}
			else
			{
				if (!(raycastHit2D.collider.transform == option8))
				{
					return;
				}
				displayer.ChangeType(OperationDisplayerItem.Type.Game8);
			}
			Singleton<AudioManager>.Instance.PlaySound("sound_btn_1");
		}
	}
}
